package com.leigang.rocketmq.service;

import com.leigang.rocketmq.config.RocketConsumer;
import com.leigang.rocketmq.config.RocketProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author leig-a
 * @version 1.0
 * @desc
 * @date 2022/9/19 10:25
 */
@Service
public class RockerServiceImpl implements IRockerService{
    @Autowired
    private RocketProducer producer;
    @Autowired
    private RocketConsumer consumer;

    @Override
    public String sendMsg(String topic, String tag, String message) {
        String send = producer.send(topic, tag, message);
        return send;
    }

    @Override
    public boolean receiveMsg(String topic, String tag) {
        consumer.messageListener(topic, tag);
        return true;
    }
}
